home *** CD-ROM | disk | FTP | other *** search
- ;*******************************************************************************
- ;* This is the hardware interrupt handler for the protected mode V86 Monitor. *
- ;* The standard IRQ's have been relocated to 20H-27H, and the second set used *
- ;* by the AT are left in the same place. All this handler does is reflect all *
- ;* interrupts back to V86 mode for processing by the standard BIOS handlers. *
- ;*******************************************************************************
-
- ;For use in V86.ASM, etc.
-
- ;(C) 1993 American Eagle Publications, Inc., All rights reserved!
-
-
- ;This routine handles the timer hardware interrupt, normally INT 8 in a PC,
- ;but this is INT 20H here!
- TIMER_HANDLER:
- push ebx
- mov bl,8 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- ;This routine handles the keyboard hardware interrupt, normally INT 9 in a PC,
- ;but this is INT 21H here!
- KBD_HANDLER:
- push ebx
- mov bl,9 ;point to keyboard vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_A:
- push ebx
- mov bl,10 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_B:
- push ebx
- mov bl,11 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_C:
- push ebx
- mov bl,12 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_D:
- push ebx
- mov bl,13 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_E:
- push ebx
- mov bl,14 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_F:
- push ebx
- mov bl,15 ;point to timer vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_70:
- push ebx
- mov bl,70H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_71:
- push ebx
- mov bl,71H ;point to VM vector
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_72:
- push ebx
- mov bl,72H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_73:
- push ebx
- mov bl,73H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_74:
- push ebx
- mov bl,74H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_75:
- push ebx
- mov bl,75H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_76:
- push ebx
- mov bl,76H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- INT_77:
- push ebx
- mov bl,77H ;point to VM vectorr
- jmp SHORT HW_HANDLER ;go do the usual hardware handling
-
- HW_HANDLER:
- push ebp
- mov ebp,esp
- push eax
- push ecx
-
- mov ax,BIOS_SEL
- mov ds,ax
- xor eax,eax
- mov al,bl
- shl eax,2 ;eax=@ of interrupt vector
- push eax
-
- cmp eax,9*4 ;was it the keyboard handler?
- jnz SHORT HW_HNDLR2 ;nope, go on
- mov ebx,417H ;else check for Ctrl-Alt-Del
- mov ebx,[ebx] ;get keyboard status byte
- and bl,00001100B
- xor bl,00001100B ;see if Ctrl and Alt are down
- jnz SHORT HW_HNDLR2
- in al,[60H] ;get byte from kb controller
- cmp al,83 ;is it the DEL key?
- jnz SHORT HW_HNDLR2 ;nope, go on
- mov al,0F0H ;yes, activate reset line
- out [64H],al
- jmp $ ;and wait here for it to go
-
- HW_HNDLR2:
- xor ebx,ebx
- mov bx,[ebp+24] ;get VM ss
- shl ebx,4 ;make absolute @ from it
- mov ecx,[ebp+20] ;get VM sp
- sub ecx,6
- add ebx,ecx ;absolute @ of stack in ebx
- mov eax,[ebp+16] ;get flags from VM caller
- mov [ebx+4],ax ;put flags on VM stack
- and eax,0FFFFFDFFH ;cli
- mov [ebp+16],eax ;save flags with cli for return
- mov ax,[ebp+12] ;get VM cs
- mov [ebx+2],ax ;save it on VM stack
- mov eax,[ebp+8] ;get VM ip
- mov [ebx],ax ;save it on VM stack
- mov [ebp+20],ecx ;and update it
-
- pop ebx
- mov eax,[ebx] ;get VM ISR @ for this interrupt
- mov [ebp+8],ax ;save VM int handler as return ip
- shr eax,16
- mov [ebp+12],ax ;and return cs
-
- pop ecx
- pop eax
- pop ebp
- pop ebx ;clean up and exit
- iretd
-